$(document).ready(function(){
//	$("#who").click(function(){
//		this.value = "";
//	});
	
	$("#where").click(function(){
		this.value = "";
	});
	
	$("#what").click(function(){
		this.value = "";
	});
	
	$("#price").click(function(){
		this.value = "";
	});
	
	$("#share").click(function(){
//		var who = document.getElementById('who').value;
//		var who1 = new String(who);
//		if((who1.length == 0) || (who1.replace(/(^\s)|(\s*$)/g,"").length == 0)){
//			window.lemon.js2client(7,"每个物品都该有一个主人，写上即将拥有这件物品的主人名字吧。");
//			return;
//		}
		
		var where = document.getElementById('where').value;
		var where1 = new String(where);
		if((where1.length == 0) || (where1.replace(/(^\s)|(\s*$)/g,"").length == 0) || (where1 == "点击输入去哪")){
			window.lemon.js2client(7,"出发之前，先确定去哪吧！");
			return;
		}
		
		var what = document.getElementById('what').value;
		var what1 = new String(what);
		if((what1.length == 0) || (what1.replace(/(^\s)|(\s*$)/g,"").length == 0) || (what1 == "点击输入买什么")){
			window.lemon.js2client(7,"好了，出发吧！等等，想买什么东西呢？");
			return;
		}
		
		var what = document.getElementById('price').value;
		var price1 = new String(what);
		if((price1.length == 0) || (price1.replace(/(^\s)|(\s*$)/g,"").length == 0) || (price1 == "点击输入价格")){
			window.lemon.js2client(7,"好了，出发吧！等等，带过少钱出门啊？");
			return;
		}
		
		window.lemon.httpGet(server_address+"/tom/servlet/C2S9wantBuy?user_id="+user_id+"&place="+where1+"&thing="+what1+"&price="+price1);
//		document.getElementById('who').value ="点击输入谁";
		document.getElementById('where').value ="点击输入去哪";
		document.getElementById('what').value ="点击输入买什么";
		document.getElementById('price').value ="点击输入价格";
		window.location.reload();
	});
	
});


$(document).ready(function(){
		$("div.content").click(function(){
			window.lemon.js2client(2,"friends_detail.html?_id="+this.id+"&user_id="+user_id);
		});
});
		
var sqlrlt = window.lemon.searchTable("select _id from User;");
var sqlrlt1 = new String(sqlrlt);
var begin = sqlrlt1.lastIndexOf(":")+2;
var end = sqlrlt1.lastIndexOf("\"");
var user_id = sqlrlt1.substring(begin,end);


var sqlrlt = window.lemon.searchTable("select phone_number from User;");
var sqlrlt1 = new String(sqlrlt);
var begin = sqlrlt1.lastIndexOf(":")+2;
var end = sqlrlt1.lastIndexOf("\"");
var nick_name = sqlrlt1.substring(begin,end);